package com.cloud.feign;

import io.seata.core.context.RootContext;
import io.seata.core.exception.TransactionException;
import io.seata.tm.api.GlobalTransactionContext;
import org.springframework.stereotype.Component;

/**
 * @Author wenbo
 * @Date 2022/12/27 17:08
 **/
@Component
public class ItemFeignServiceFallback implements ItemFeignService {
    @Override
    public String doOrder() {
        return "限流了";
    }

    @Override
    public String getItemInfo(String s) {
        return "限流了";
    }


    @Override
    public String decStock(Long productId, Long productSpecs) {
        return "限流了";
    }

    @Override
    public String decStock2() throws TransactionException {
        GlobalTransactionContext.reload(RootContext.getXID()).rollback();
        return "feign限流";
    }
}
